<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>运算符</title>
</head>
<body>
<script>
    var a = 10;
    const b = 3;
    console.log("相加结果为" + (a + b));
    console.log("相减结果为" + (a - b));
    console.log("相除结果为" + (a / b));
    console.log("相乘结果为" + (a * b));
    console.log("自增结果" + ++a);

    console.log(a + "自加10之后结果为" + (a += 10));
    console.log(a + "自乘10之后结果为" + (a *= 10));
    var a1 = 10;
    var b1 = 5;
    console.log(a1 > b1);
    console.log(a1 < b1);

    var b2 = "10";
    console.log("==比较10和\"10\"" + (a1 == b2));//比较内容
    //"==="----->既比较内容，也比较数值
    console.log("===比较10和\"10\"为" + (a1 === b2));//false
    var b3 = true;
    console.log("==比较1和true的结果为" + (1 == b3));//true在比较时内容为1
    console.log("====比较1和true的结果为" + (1 === true))//false

    //逻辑运算符  与 & 或 | 非 ！
    //使用逻辑运算符，一个& | 运算符运算的结果为1或者是0，使用&&、||结果为true 或false
    //Infinity 无穷值
    /**
     * Infinity等于Infinity
     * NaN不等于NaN
     * Undefined等于Undefined
     * null等于null
     * undefined数值转换后为NaN
     * true转换数值为1
     * false转换数值后为0
     * @type {number}
     */
    var x = 10;
    var y = 20;
    console.log("------")
    console.log((x > y) && (x == y));//如果用一个是位运算  false
    console.log((x < y) || (x == y));//false
    console.log(!(x > y));//true
    console.log("Infinity自身相等于结果为"+(Infinity==Infinity));
    console.log("NaN自身相等于结果为"+(NaN==NaN));
    console.log("undefined自身相等于结果为"+(undefined==undefined));
    console.log("null自身相等于结果为"+(null==null));

    //三元运算符  对后面类型没有限制
    var val=x<y?"真的":false;
    console.log(val)
</script>
</body>
</html>